<template>
  <div>
    <br />
    <br />

    <div class="bottom">
      <p>
        <input
          @change="checkBtn"
          v-model="flag"
          type="checkbox"
          name=""
          id=""
        />
      </p>
      <p>总价{{ subtotal }}</p>
      <p v-if="flagTap">去支付{{ num }}</p>
      <p @click="removecheck" v-else>删除选中({{ trueLength }})</p>
    </div>
  </div>
</template>

<script>
import { ref } from "vue";
export default {
  props: {
    flag: Boolean,
    num: Number,
    subtotal: Number,
    flagTap: Boolean,
    trueLength: Number,
  },
  emits: ["checkALL", "removecheck"], // 使用emits触发组件有警告加上这个
  setup(props, context) {
    console.log(props);
    console.log(context);
    function checkBtn() {
      context.emit("checkALL", event.target.checked);
    }
    function removecheck() {
      context.emit("removecheck");
    }
    return {
      checkBtn,
      removecheck,
    };
  },
};
</script>

<style lang="scss" scoped>
[type="checkbox"] {
  width: 20px;
  height: 20px;
}
.bottom {
  width: 100%;
  height: 40px;
  background-color: rgb(240, 33, 33);
  display: flex;
  align-items: center;
  justify-content: space-around;
  color: #fff;
  position: fixed;
  bottom: 0;
  left: 0;
}
</style>
